home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / BASCRUNCH.SPK / !BasCrunch / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1993-03-02  |  9KB  |  376 lines

  1.  ><BasCrunch$Dir>.!RunImage
  2.  This application is FreeWare. (c) 1993 Dick Alstein
  3. error
  4. quit%=
  5. .mask%=(1<<4)+(1<<5)+(1<<7)+(1<<11)+(1<<12)
  6.  "Wimp_Poll",mask%,blk% 
  7.  reason%
  8.  reason% 
  9. (    
  10.  2 : 
  11.  "Wimp_OpenWindow",,blk%
  12. )    
  13.  3 : 
  14.  "Wimp_CloseWindow",,blk%
  15. ?    
  16.  6 : 
  17. mouseclick(blk%!0,blk%!4,blk%!8,blk%!12,blk%!16)
  18.      
  19.  7 : 
  20. startsavedialogue
  21. *    
  22.  8 : 
  23.  "Wimp_ProcessKey",blk%!24
  24.  9 : 
  25. menuselect(blk%)
  26. 1    
  27.  17,18 : 
  28. receive(blk%!4,blk%!8,blk%!16)
  29.  quit%
  30.  "Wimp_CloseDown"
  31. defaultstatus
  32. keeprems%=
  33. keepemptylines%=
  34. keepvarnames%=
  35. keepprocnames%=
  36. keepswinames%=
  37. nomultilines%=
  38. editableoutput%=
  39. make0rem%=
  40. $(exceptionsfname%)=""
  41. errbox(err$,boxes%)
  42. errblk%!0=0
  43. $(errblk%+4)=err$+
  44.  "Wimp_ReportError",errblk%,boxes%,Appl$ 
  45.  ,click%
  46. =(click%=1)
  47. error
  48.  "Wimp_CloseDown" : 
  49. errbox(
  50. $+" (line "+
  51. )+")",3) 
  52.  "Wimp_CloseDown"
  53. Appl$="BasCrunch"
  54.  errblk% &100
  55.  "Wimp_Initialise",200,&4B534154,Appl$ 
  56.  ,thistask%
  57. error
  58.  scrapblk% 64
  59.  blk% &500
  60. indsize%=&400
  61.  indir% indsize%
  62. indirend%=indir%+indsize%
  63.  ptrinfo% 24
  64. scrapblk%!0=-1
  65. >!scrapblk%!4=0 : scrapblk%!8=0
  66. ?%scrapblk%!12=68 : scrapblk%!16=68
  67. scrapblk%!20=&7000301A
  68. A $(scrapblk%+24)="!bascrunch"
  69.  "Wimp_CreateIcon",,scrapblk% 
  70.  baricon%
  71.  "Wimp_OpenTemplate",,"<BasCrunch$Dir>.Templates"
  72. D"infowin%=
  73. loadtemplate("Info")
  74. E$optwin%=
  75. loadtemplate("Options")
  76. F'exceptionsfname%=blk%!(92+13*32+20)
  77. G%savewin%=
  78. loadtemplate("SaveBox")
  79. H savefname%=blk%!(92+0*32+20)
  80.  "Wimp_CloseTemplate"
  81. initmenus
  82. readscreenvars
  83. loadstatus
  84. selecticon(optwin%,2,
  85.  keeprems%)
  86. selecticon(optwin%,3,
  87.  keepemptylines%)
  88. selecticon(optwin%,4,
  89.  keepvarnames%)
  90. selecticon(optwin%,5,
  91.  keepprocnames%)
  92. selecticon(optwin%,6,
  93.  keepswinames%)
  94. selecticon(optwin%,7,
  95.  nomultilines%)
  96. selecticon(optwin%,8,editableoutput%)
  97. selecticon(optwin%,9,make0rem%)
  98. shadeicons
  99. initmenus
  100.  "MenuUtil_Initialise",010,0
  101.  "MenuUtil_New",,Appl$ 
  102.  mainmenu%
  103.  "MenuUtil_Add",mainmenu%,"Info" 
  104.  item_info%
  105.  "MenuUtil_Add",mainmenu%,"Options..." 
  106.  item_options%
  107.  "MenuUtil_Add",mainmenu%,"Quit" 
  108.  item_quit%
  109.  "MenuUtil_SubMenu",item_info%,infowin%
  110. leafname(f$)
  111.  p%,q%
  112.   p%=q%+1
  113.   q%=
  114. f$,".",p%)
  115.  q%=0
  116. f$,p%)
  117. loadstatus
  118.  efn$
  119. m$F%=
  120.  ("<BasCrunch$Dir>.Options")
  121.  #F% : 
  122. error : 
  123. defaultstatus : 
  124. #F%,keeprems%,keepemptylines%,keepvarnames%,keepprocnames%
  125. #F%,keepswinames%,nomultilines%,editableoutput%,make0rem%
  126. #F%,efn$
  127. $(exceptionsfname%)=efn$
  128. loadtemplate(name$)
  129.  handle%
  130.  "Wimp_CloseTemplate" : 
  131. error
  132.  "Wimp_LoadTemplate",,blk%+4,indir%,indirend%,-1,name$,0 
  133.  ,,indir%
  134.  "Wimp_CreateWindow",,blk%+4 
  135.  handle%
  136. =handle%
  137. menuselect(selection%)
  138.  "Wimp_GetPointerInfo",,ptrinfo%
  139.  selection%!0 
  140.     blk%!0=optwin%
  141. &    
  142.  "Wimp_GetWindowState",,blk%
  143. "    
  144.  "Wimp_OpenWindow",,blk%
  145.     quit%=
  146.  (ptrinfo%!8 
  147. showmenu(0)
  148. mouseclick(xpos%,ypos%,button%,wndw%,icon%)
  149.  wndw% 
  150.  button% 
  151.       
  152.         
  153. showmenu(blk%)
  154.       
  155.         blk%!0=optwin%
  156. *        
  157.  "Wimp_GetWindowState",,blk%
  158. &        
  159.  "Wimp_OpenWindow",,blk%
  160.         
  161.  optwin%
  162.  icon% 
  163. %      
  164.  2 : keeprems%=
  165.  keeprems%
  166. 1      
  167.  3 : keepemptylines%=
  168.  keepemptylines%
  169. -      
  170.  4 : keepvarnames%=
  171.  keepvarnames%
  172.         
  173. shadeicons
  174. /      
  175.  5 : keepprocnames%=
  176.  keepprocnames%
  177. -      
  178.  6 : keepswinames%=
  179.  keepswinames%
  180. -      
  181.  7 : nomultilines%=
  182.  nomultilines%
  183. 1      
  184.  8 : editableoutput%=
  185.  editableoutput%
  186. %      
  187.  9 : make0rem%=
  188.  make0rem%
  189.       
  190.         
  191. savestatus
  192.       
  193.         scrapblk%!0=optwin%
  194. ,        
  195.  "Wimp_CloseWindow",,scrapblk%
  196.         
  197.  savewin%
  198.  icon% 
  199.       
  200.  1 : 
  201. startsavedrag
  202.         
  203. readscreenvars
  204.  xeig%,yeig%,xpixels%,ypixels%
  205.  "OS_ReadModeVariable",-1,4 
  206.  ,,xeig%
  207.  "OS_ReadModeVariable",-1,5 
  208.  ,,yeig%
  209.  "OS_ReadModeVariable",-1,11 
  210.  ,,xpixels%
  211.  "OS_ReadModeVariable",-1,12 
  212.  ,,ypixels%
  213. Escreensize_x%=(xpixels%+1)*(1<<xeig%) : 
  214.  screen size in OS units
  215. )screensize_y%=(ypixels%+1)*(1<<yeig%)
  216. receive(sender%,ref%,code%)
  217.  ack%,icon%,window%,fname$,ftype%,fsize%
  218. ack%=0
  219.  sender% <> thistask% 
  220.  code% 
  221.  0 : quit%=
  222. $      outputfname$=
  223. str(blk%+44)
  224.       
  225. startcrunch
  226.       ack%=3
  227.       window%=blk%!20
  228.       icon%=blk%!24
  229.       fname$=
  230. str(blk%+44)
  231.       ftype%=blk%!40
  232. -      
  233.  (window%=optwin%)
  234. (ftype%=&FFF) 
  235.         
  236.  icon% 
  237.           
  238.  10,11,12,13
  239. *            $(exceptionsfname%)=fname$
  240. )            
  241. selecticon(optwin%,13,0)
  242.         
  243.       
  244. 9      
  245.  (window%=-2)
  246. (icon%=baricon%)
  247. (ftype%=&FFB) 
  248.         inputfname$=fname$
  249.         inputfsize%=blk%!36
  250. +        $(savefname%)=
  251. leafname(fname$)
  252.          scrapblk%!0=savewin%
  253. /        
  254.  "Wimp_GetWindowState",,scrapblk%
  255. .        
  256.  "Wimp_GetPointerInfo",,ptrinfo%
  257. <        xpos%=ptrinfo%!0-((scrapblk%!12-scrapblk%!4)
  258. -        ypos%=96+scrapblk%!16-scrapblk%!8
  259. 6        
  260.  "Wimp_CreateMenu",,savewin%,xpos%,ypos%
  261.       
  262.  &400C1
  263.       
  264. readscreenvars
  265.  ack%<>0 
  266.     blk%!0=256
  267.     blk%!12=ref%
  268.     blk%!16=ack%
  269. -    
  270.  "Wimp_SendMessage",17,blk%,sender%
  271. savestatus
  272.  ("<BasCrunch$Dir>.Options")
  273.  #F% : 
  274. error : 
  275. #F%,keeprems%,keepemptylines%,keepvarnames%,keepprocnames%
  276. #F%,keepswinames%,nomultilines%,editableoutput%,make0rem%
  277. #F%,$(exceptionsfname%)
  278. selecticon(window%,icon%,f%)
  279. scrapblk%!0=window%
  280. scrapblk%!4=icon%
  281.   scrapblk%!8=1<<21
  282.   scrapblk%!8=0
  283. scrapblk%!12=1<<21
  284.  "Wimp_SetIconState",,scrapblk%
  285. iconselected(window%,icon%)
  286. scrapblk%!0=window%
  287. scrapblk%!4=icon%
  288.  "Wimp_GetIconState",,scrapblk%
  289. #=((scrapblk%!24) 
  290.  (1<<21)) > 0
  291. shadeicon(window%,icon%,f%)
  292. scrapblk%!0=window%
  293. scrapblk%!4=icon%
  294.   scrapblk%!8=(1<<22)
  295.   scrapblk%!8=0
  296. scrapblk%!12=1<<22
  297.  "Wimp_SetIconState",,scrapblk%
  298. shadeicons
  299. shadeicon(optwin%,5,
  300. iconselected(optwin%,4))
  301. showmenu(blkptr%)
  302.  "MenuUtil_Show",mainmenu%,blkptr%
  303. startsavedialogue
  304.  dragasprite% 
  305.  "DragASprite_Stop"
  306. blk%!0=64
  307. blk%!12=0
  308. blk%!16=1
  309.  "Wimp_GetPointerInfo",,ptrinfo%
  310. blk%!20=ptrinfo%!12
  311. blk%!24=ptrinfo%!16
  312. blk%!28=ptrinfo%!0
  313. blk%!32=ptrinfo%!4
  314. blk%!36=inputfsize%
  315. blk%!40=&FFB
  316. !*$(blk%+44)=
  317. leafname($(savefname%))+
  318.  "Wimp_SendMessage",17,blk%,ptrinfo%!12,ptrinfo%!16
  319. startsavedrag
  320.  b%,win0x%,win0y%
  321. scrapblk%!0=savewin%
  322.  "Wimp_GetWindowState",,scrapblk%
  323. )#win0x%=scrapblk%!4-scrapblk%!20
  324. *$win0y%=scrapblk%!16-scrapblk%!24
  325. scrapblk%!0=savewin%
  326. scrapblk%!4=1
  327.  "Wimp_GetIconState",,scrapblk%
  328. blk%!4=5
  329. blk%!8=scrapblk%!8+win0x%
  330. blk%!12=scrapblk%!12+win0y%
  331. blk%!16=scrapblk%!16+win0x%
  332. blk%!20=scrapblk%!20+win0y%
  333.  "Wimp_GetPointerInfo",,ptrinfo%
  334. blk%!24=blk%!8-ptrinfo%!0
  335. blk%!28=blk%!12-ptrinfo%!4
  336. 6,blk%!32=screensize_x%+blk%!16-ptrinfo%!0
  337. 7,blk%!36=screensize_y%+blk%!20-ptrinfo%!4
  338.  "OS_Byte",161,&1C 
  339.  ,,b%
  340. dragasprite%=(b% 
  341.  2)<>0
  342.  dragasprite% 
  343.  "DragASprite_Start",&A1,1,"file_ffb",blk%+8,blk%+24
  344.  "Wimp_DragBox",1,blk%
  345. startcrunch
  346.  cmd$
  347. C#cmd$="<BasCrunch$Dir>.ccrunch "
  348.  keeprems% 
  349.   cmd$+="-r "
  350.  keepemptylines% 
  351.   cmd$+="-e "
  352.  keepvarnames% 
  353.   cmd$+="-s "
  354.  keepprocnames% 
  355.     cmd$+="-f "
  356.  keepswinames% 
  357.   cmd$+="-n "
  358.  nomultilines% 
  359.   cmd$+="-m "
  360.  editableoutput% 
  361.   cmd$+="-t "
  362.  make0rem% 
  363.   cmd$+="-0 "
  364.  $(exceptionsfname%)<>"" 
  365. ^(  cmd$+="-x"+$(exceptionsfname%)+" "
  366. `&cmd$+=inputfname$+" "+outputfname$
  367.  "Wimp_StartTask",cmd$
  368.  "Wimp_CreateMenu",,-1
  369. str(s%)
  370.  i%,n$
  371.  (s%?i%>=32) 
  372.  (i%<255)
  373.   n$+=
  374. (s%?i%)
  375.   i%+=1
  376.